//due to a bug in android 2.1 and 2.2
//see http://code.google.com/p/android/issues/detail?id=6191 why this is needed

package name.flurl.android.tt_news4android;

import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ViewFlipper;

public class BugEatingViewFlipper extends ViewFlipper {
	public BugEatingViewFlipper(Context context) {
		super(context);
	}

	public BugEatingViewFlipper(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void onDetachedFromWindow() {
		int apiLevel = Build.VERSION.SDK_INT;
		if (apiLevel == 7 || apiLevel == 8) {
			try {
				super.onDetachedFromWindow();
			} catch (IllegalArgumentException e) {
				// Call stopFlipping() in order to kick off updateRunning()
				stopFlipping();
			}
		} else {
			super.onDetachedFromWindow();
		}
	}
}